package com.code.AZPlan.model.po;

import com.code.commons.model.po.BasePO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Id;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * AZ计划兑换持久层对象
 *
 * @author tangyifei
 * @since 2020年1月4日10:40:03
 */
@ApiModel("AZ计划兑换持久层对象")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler"})
public class ExchangeFlow extends BasePO<String> {

    private static final long serialVersionUID = 7068732026288231051L;

    @ApiModelProperty(value = "主键", example = "1")
    @Id
    @Length(min = 1, max = 64)
    private String id;

    @ApiModelProperty(value = "用户主键", example = "1")
    @NotBlank(message = "用户主键不能为空")
    @Length(min = 1, max = 64)
    private String userId;

    @ApiModelProperty(value = "兑换后的币种类型（XWC、BTC等）", example = "XWC")
    @NotBlank(message = "兑换后的币种类型（XWC、BTC等）不能为空")
    private String coinTypeAfter;

    @ApiModelProperty(value = "USD的金额(非必填，主要用于服务器处理)", example = "1000USD")
    private BigDecimal usdAmount;

    @ApiModelProperty(value = "兑换的金额XWC或者BTC金额", example = "1000XWC或者1000BTC")
    @NotNull(message = "兑换的金额XWC或者BTC金额不能为空")
    private BigDecimal exchangeAmount;

    @ApiModelProperty(value = "交易密码", example = "1")
    @NotBlank(message = "交易密码不能为空")
    private String tranPwd;

    @ApiModelProperty(value = "AZ钱包的版本号", example = "1")
    @NotNull(message = "AZ钱包的版本号不能为空")
    private Integer azPlanWalletVersion;

    @ApiModelProperty(value = "用户账号", example = "XXXXXX")
    private String userAccount;

    @ApiModelProperty(value = "价格", example = "0.149163")
    private String price;

    @ApiModelProperty(value = "兑换时间", example = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private Date exchangeTime;
}
